<?php

require_once 'q/mysql.php';
require_once 'q/memcache.php';

class q_dao {

    protected $_db = array();

    protected function _getdb($setting){
        ksort($setting);
        $key = http_build_query($setting);
        if(empty($this->_db[$key])) {
            $this->_db[$key] = q_mysql::getInstance($setting);
        }
        return $this->_db[$key];
    }

    protected $_mc = array();

    protected function _getmc($setting){
        ksort($setting);
        $key = http_build_query($setting);
        if(empty($this->_mc[$key])) {
            $this->_mc[$key] = new q_memcache($setting);
        }
        return $this->_mc[$key];
    }

}

